package com.example.springboot.config.redis.lock;

import org.redisson.api.RLock;

import java.util.concurrent.TimeUnit;

/**
 * 分布式锁接口
 *
 * @Author:ChenZhangKun
 * @Date: 2021/5/22 16:24
 */
public interface DistributedLock {
    //
    RLock lock(String lockKey);

    RLock lock(String lockKey, int timeout);

    RLock lock(String lockKey, TimeUnit unit, int timeout);
    // 尝试加锁
    boolean tryLock(String lockKey, TimeUnit unit, int waitTime, int leaseTime);
    // 解锁
    void unlock(String lockKey);

    void unlock(RLock lock);

}
